<template>
	<view>
		<u-navbar  title="报名信息" :autoBack="true" safeAreaInsetTop fixed placeholder />
		<view>
			<uni-card :cover="cover" title="基本信息" padding="0">
				<view>
					<u-cell-group>
						<u-cell center :arrow="false" title="学员姓名">
							<view class="u-font-md text-black" slot="value">{{info.studentName}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="课程名称">
							<view class="u-font-md text-black" slot="value">{{info.courseName}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="课程科目">
							<view class="u-font-md text-black" slot="value">{{info.subjectName}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="开始日期">
							<view class="u-font-md text-black" slot="value">{{formatTime(info.startDate,'{y}-{m}-{d}')}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="课程金额">
							<view class="u-font-md text-black" slot="value">￥{{info.amount}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="已付金额">
							<view class="u-font-md text-black" slot="value">￥{{info.paidAmount}}</view>
						</u-cell>
						
						<!-- <u-cell center :arrow="false" title="待付金额" v-show="info.remainingAmount">
							<view class="u-font-md text-black" slot="value">￥{{info.remainingAmount}}</view>
						</u-cell> -->
						
						<u-cell center :arrow="false" title="折扣金额">
							<view class="u-font-md text-black" slot="value">￥{{info.discountAmount}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="过期日期">
							<view class="u-font-md text-black" slot="value">{{formatTime(info.expireDate,'{y}-{m}-{d}')}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="报名时间">
							<view class="u-font-md text-black" slot="value">{{formatTime(info.createTime,'{y}-{m}-{d}')}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="备注说明">
							<view class="u-font-md text-black" slot="value">{{info.remark?info.remark:''}}</view>
						</u-cell>
					</u-cell-group>
				</view>
			</uni-card>
			
			<uni-card :cover="cover" title="课次进度" padding="0">
				<view>
					<u-cell-group>
						<u-cell center :arrow="false" title="已完成课次">
							<view class="u-font-md text-black" slot="value">{{info.countLessonComplete}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="剩余课次数">
							<view class="u-font-md text-black" slot="value">{{info.countLessonRemaining}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="总购买课次">
							<view class="u-font-md text-black" slot="value">{{info.countLessonTotal}}</view>
						</u-cell>
					</u-cell-group>
				</view>
			</uni-card>
			
			<uni-card :cover="cover" title="退款信息" padding="0">
				<view>
					<u-cell-group>
						<u-cell center :arrow="false" title="退款金额">
							<view class="u-font-md text-black" slot="value">{{info.refundAmount}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="退款课次">
							<view class="u-font-md text-black" slot="value">{{info.refundLessonCount}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="退款状态">
							<view class="u-font-md text-black" slot="value">{{info.refundState}}</view>
						</u-cell>
						
						<u-cell center :arrow="false" title="退款说明">
							<view class="u-font-md text-black" slot="value">{{info.refundRemark}}</view>
						</u-cell>
					</u-cell-group>
				</view>
				
				<!-- 
				<view class="bg-white u-padding-30 u-margin-bottom-20 line-height-md" v-else>
					<view> <text class="text-gray u-margin-right-20">无</text></view>
				</view> 
				-->
			</uni-card>
		</view>
	</view>
</template>
<script>
	import request from '@/utils/request'
	import { parseTime } from '@/utils/zhanpeng.js'
	export default {
		components: {},
		data() {
			return {
				contractId: '',
				info: {},
				studentList: [],
			}
		},
		onLoad(option) {
			this.contractId = option.contractId
			this.getInfo()
		},
		methods: {
			formatTime(time,pattern) {
				return parseTime(time,pattern)
			},
			getInfo() {
				request({url:'/edu/student-course/get', data:{
					id: this.contractId
				}}).then(res => {
					if (!this.$common.handleResponseMsg(res)) return;
					this.info = res.data
				});
			},
			clickLeft() {
				uni.navigateTo({
					url: '/pages/contract/index'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
